<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <title>用户信息详情</title> <#include "/view/head.html"/>
    <script type="text/javascript"
            src="${base}/jstool/bootstrap-switch/bootstrap-switch.min.js"></script>
    <script type="text/javascript"
            src="${base}/jstool/bootstrap-fileinput/js/fileinput.js"></script>
    <script type="text/javascript"
            src="${base}/jstool/bootstrap-fileinput/js/locals/zh.js"></script>
    <link rel="stylesheet" type="text/css"
          href="${base}/jstool/bootstrap-switch/bootstrap-switch.min.css" />
    <link rel="stylesheet" type="text/css"
          href="${base}/jstool/bootstrap-fileinput/css/fileinput.min.css" />


    <style type="text/css">
        .list-path {
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;
        }

        .table-class {
            width: 90%;
            text-align: center;
            border: 1px solid #afd9ee;
            margin: 0 auto;
            margin-top: 50px;
        }

        table th {
            width: 20%;
            background-color: #d9edf7;
            text-align: right;
        }

        table td {
            width: 20%;
            text-align: left;
        }

        .go-back {
            float: right;
            margin-right: 30px;
        }
    </style>
    <script type="text/javascript">
        $(function() {

            $('#f').fileinput({
                language : 'zh', //设置语言
                allowedFileExtensions : [ 'jpg', 'png', 'gif' ],//接收的文件后缀
                showUpload : false, //是否显示上传按钮
                showCaption : false,//是否显示标题
                browseClass : "btn btn-primary", //按钮样式
                previewFileIcon : "<i class='glyphicon glyphicon-king'></i>",
            });

        });
    </script>
</head>
<body>

<div class="list-path">
		<span style="margin-left: 50px;"> <a
                href="${base}/approve/index.do"><span
                class="glyphicon glyphicon-home"></span> 用户审批信息列表</a> / <a
                href="${base}/approve/record.do?id=${entity.userinfoId!}">用户审批记录列表</a>
			/ 用户信息详情
		</span>
    <div style="float: right; margin-right: 40px;">
        <a class="btn btn-info"
           href="${base}/approve/record.do?id=${entity.userinfoId!}">返回上一级</a>
    </div>
</div>


<div class="table-class">
    <#if msg??>
        <div class="alert alert-error"
             style="background-color: #f2dede; color: #a94442;">
            <a class="close" data-dismiss="alert">×</a> <strong>错误!</strong>${msg!}
        </div>
    </#if>
    <table class="table table-bordered">
        <thead>
        <!-- <tr>
    <th colspan="4">xxxxx</th>
</tr>-->
        </thead>
        <tbody>
        <tr>
            <th>姓名：</th>
            <td>${entity.name!}</td>
            <th rowspan="5">头像：</th>
            <td rowspan="5"><img src="${base}/${entity.picPath!}"
                                 height="140px;"></td>
        </tr>
        <tr>
            <th>手机号：</th>
            <td>${entity.telephone!}</td>
        </tr>
        <tr>
            <th>性别：</th>
            <td><#if entity.sex??> <#if 0==entity.sex>女</#if> <#if
                    1==entity.sex>男</#if> </#if></td>
        </tr>
        <tr>
            <th>身份证：</th>
            <td>${entity.idCard!}</td>
        </tr>
        <tr>
            <th>年龄：</th>
            <td>${entity.age!}</td>
        </tr>
        <tr>
            <th>别名：</th>
            <td>${entity.nick!}</td>
            <th>所在地：</th>
            <td>${entity.locus!}</td>
        </tr>

        <tr>
            <th>是否是直播网红：</th>
            <td><#if entity.irectSeeding??> <#if
                    0==entity.irectSeeding>否</#if> <#if 1==entity.irectSeeding>是</#if>
            </#if></td>
            <th>所属直播平台：</th>
            <td>${entity.uusee!}</td>
        </tr>
        <tr>
            <th>粉丝数量：</th>
            <td>${entity.fans!}</td>
            <th>代言活动：</th>
            <td><#if entity.represent??> <#if
                    1==entity.represent>红色出行代言人</#if> <#if
                    2==entity.represent>绿色出行代言人</#if> <#if
                    3==entity.represent>橙色出行代言人</#if> </#if></td>
        </tr>
        <tr>
            <th>创建时间：</th>
            <td><#if (entity.createtime)??
            >${entity.createtime?string('yyyy-MM-dd HH:mm')}</#if></td>
            <th>描述：</th>
            <td>${entity.content!}</td>
        </tr>
        <tr>
            <th>审批状态：</th>
            <td id="approve-td"><#if entity.approveStatus??> <#if
                    0==entity.approveStatus><span class="label label-default">待审批中</span></#if>
                <#if 1==entity.approveStatus><span class="label label-success">审批通过</span></#if>
                <#if 2==entity.approveStatus><span class="label label-danger">审批不通过</span></#if>
            </#if>
            </td>
            <th>显示状态：</th>
            <td id="isuse-td"><#if entity.isuse??> <#if 0==entity.isuse><span
                    class="label label-default">未显示</span></#if> <#if 1==entity.isuse><span
                    class="label label-success">显示</span></#if> </#if>
            </td>

        </tr>


        <tr>
            <td colspan="4" width="100%" style="text-align: center;"><#if
                    entity.approveStatus??> <#if 1==entity.approveStatus> <a
                    class="btn btn-danger approve-btn"
                    href="javascript:switchApprove(2)">审批不通过</a></#if> <#if
                    2==entity.approveStatus> <a
                    class="btn btn-success  approve-btn btn-approve"
                    href="javascript:switchApprove(1)">审批通过</a></#if> <#if
                    0==entity.approveStatus> <a
                    class="btn btn-success  approve-btn btn-approve"
                    href="javascript:switchApprove(1)">审批通过</a>&nbsp;<a
                    class="btn btn-danger approve-btn"
                    href="javascript:switchApprove(2)">审批不通过</a></#if> </#if> <span>&nbsp;</span>
                <#if entity.isuse??> <#if 0==entity.isuse><a style="display: none"
                                                             class="btn btn-success isuse-btn"
                                                             href="javascript:switchisuse('${entity.userapproveId!}',1);">显示</a></#if>
                    <#if 1==entity.isuse><a style="display: none"
                                            class="btn btn-danger isuse-btn"
                                            href="javascript:switchisuse('${entity.userapproveId!}',0);">不显示</a></#if>
                </#if>


            </td>
        </tr>

        <tr>
            <th>视频下载地址：</th>
            <td id="approve-td"><#if entity.ext2 ??> <a
                    href="${base}/down?filename=${entity.ext2!}">点击链接下载视频</a> <#else>
                用户没有上传视频 </#if>
            </td>
            <th>视频上传RUL：</th>
            <td id="isuse-td"><#if entity.ext2 ??><#if  entity.vodeoUri ??>${entity.vodeoUri!}<#else><input type="text"
                                                                                                            name="vodeoUri" value="${entity.vodeoUri!}" > </#if><#else>
                用户没有上传视频,不能添加网络路径 </#if>
            </td>

        </tr>
        <tr>
            <td colspan="4" width="100%" style="text-align: center;"><span>&nbsp;</span>
                <a style="" class="btn btn-success"
                   href="javascript:updateUrl('${entity.userapproveId!}');">
                    提交
                </a>
            </td>
        </tr>
    </table>
    <form action="${base}/approve/uploadImg" method="post"  enctype="multipart/form-data" name="form">
        <table class="table table-bordered">
            <tr>
                <#if entity.picPathPng??>



                    <th>用户圆形头像：</th>
                    <td colspan="3">
                        <img src="${base}/${entity.picPathPng!}"
                             height="140px;">
                    </td>
                    <#else>
                        <th>点击上传圆形头像：</th>
                        <td colspan="3"><input type="hidden" name="userapproveId"
                                               value="${entity.userapproveId!}"> <input type="hidden"
                                                                                        name="picPath" value="${entity.picPath!}"> <input
                                type="file" name="picPathPng" id="f"/></td>
                </#if>
            </tr>
            </tr>
            <#if entity.picPathPng??>
                <#else>
                    <tr>
                        <td colspan="4" width="100%" style="text-align: center;"><span>&nbsp;</span>
                            <a style="" class="btn btn-success" href="javascript:uploadImg()">上传圆形头像</a>
                        </td>
                    </tr>
            </#if>
        </table>
    </form>

    </tbody>


</div>

<script type="text/javascript">
    function switchApprove(approveStatus) {
        $(".close").click();

        $('.btn-approve').attr('disabled', "disabled");
        $
            .ajax({
                type : "GET",
                url : "${base}/approve/approveStatus.do",
                data : {
                    userapproveId : "${entity.userapproveId!}",
                    approveStatus : approveStatus
                },
                dataType : "json",
                success : function(data) {
                    if (data.status == '1') {
                        $('.table-class')
                            .prepend(
                                '<div class="alert alert-success">'
                                + '<a href="#" class="close" data-dismiss="alert">&times;</a>修改审批状态成功。 </div>');
                    } else {
                        $('.table-class')
                            .prepend(
                                '<div class="alert alert-danger">'
                                + '<a href="#" class="close" data-dismiss="alert">&times;</a>修改审批状态失败。 '
                                + data.msg + '</div>');
                    }
                    if (approveStatus == '1') {
                        //按钮
                        if ($('.approve-btn').length == 2) {
                            $('.approve-btn')[0].remove();
                        }
                        $('.approve-btn').attr('class',
                            'btn btn-danger approve-btn');
                        $('.approve-btn').text('审批不通过');
                        $('.approve-btn').attr('href',
                            "javascript:switchApprove(2)");
                        //状态
                        $('#approve-td .label').attr('class',
                            "label label-success");
                        $('#approve-td .label').text("审批通过");

                        view_on();

                    } else {
                        //按钮
                        if ($('.approve-btn').length == 2) {
                            $('.approve-btn')[0].remove();
                        }
                        $('.approve-btn').attr('class',
                            'btn btn-success approve-btn');
                        $('.approve-btn').text('审批通过');
                        $('.approve-btn').attr('href',
                            "javascript:switchApprove(1)");
                        //状态
                        $('#approve-td .label').attr('class',
                            "label label-danger");
                        $('#approve-td .label').text("审批不通过");

                        view_off();

                    }
                },
                error : function(e) {
                    $('.table-class')
                        .prepend(
                            '<div class="alert alert-danger">'
                            + '<a href="#" class="close" data-dismiss="alert">&times;</a>修改审批状态失败！ </div>');
                }
            });

    }

    function switchisuse(userapproveId, isuse) {
        $(".close").click();
        $
            .ajax({
                type : "GET",
                url : "${base}/approve/isuse.do",
                data : {
                    id : userapproveId,
                    status : isuse
                },
                dataType : "json",
                success : function(data) {
                    if (data.status == '1') {

                        $('.table-class')
                            .prepend(
                                '<div class="alert alert-success">'
                                + '<a href="#" class="close" data-dismiss="alert">&times;</a>修改显示状态成功。 </div>');
                        if (isuse == '1') {
                            view_on();

                        } else {
                            view_off()

                        }
                    } else {
                        $('.table-class')
                            .prepend(
                                '<div class="alert alert-danger">'
                                + '<a href="#" class="close" data-dismiss="alert">&times;</a>修改启用状态失败。 '
                                + data.msg + '</div>');
                    }

                },
                error : function(e) {

                }
            });

    }
    function view_on() {
        $('#isuse-td .label').attr("class", "label label-success");
        $('#isuse-td .label').text('显示');
        $('.isuse-btn').attr('href',
            "javascript:switchisuse('${entity.userapproveId!}',0)");
        $('.isuse-btn').text('不显示');
        $('.isuse-btn').attr('class', 'btn btn-danger isuse-btn');
    }
    function view_off() {
        $('#isuse-td .label').attr("class", "label label-default");
        $('#isuse-td .label').text('不显示');
        $('.isuse-btn').attr('href',
            "javascript:switchisuse('${entity.userapproveId!}',1)");
        $('.isuse-btn').text('显示');
        $('.isuse-btn').attr('class', 'btn btn-success isuse-btn');
    }

    function updateUrl(userapproveId) {

        var vodeoUri = $('input[name=vodeoUri]').val();
        if (typeof (vodeoUri) == "undefined") {

            alert("用户没有输入原始视频，不支持此操作");
            return;
        }
        $.ajax({
            type : "GET",
            url : "${base}/approve/updateUrl",
            data : {
                userapproveId : userapproveId,
                vodeoUri : vodeoUri
            },
            dataType : "json",
            success : function(data) {
                if (data.status == '1') {
                    alert(data.sta);

                } else {

                    alert(data.sta);
                }

            },
            error : function(e) {
                alert("系统繁忙");
            }
        });

    }

    function uploadImg() {

        var userapproveId = $("input[name=userapproveId]").val()
        var picPath = $("input[name=picPath]").val()
        var picPathPng = $("input[name=picPathPng]").val()

        if (userapproveId == "") {
            alert("服务器繁忙，请刷新本页面");
            return;
        }
        if (picPath == "") {
            alert("用户没有头像，不允许操作");
            return;
        }
        if (picPathPng == "") {
            alert("请上传圆形白色背景图片");
            return;
        }
        document.form.submit();

    }
</script>


</script>

</body>
</html>
